﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Forms;
using System.IO;
using Edge.Extensions;


namespace Edge.Tests.Bootstrap
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();

            textBoxFolder.Text = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
        }

        private void buttonBrowseFolder_Click(object sender, RoutedEventArgs e)
        {
            FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();

            dialog.Description = "Select a directory to show.";

            dialog.ShowNewFolderButton = true;

            dialog.RootFolder = Environment.SpecialFolder.Personal;

            DialogResult result = dialog.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                string folderName = dialog.SelectedPath;

                textBoxFolder.Text = folderName;
            }

        }

        private void buttonShowFolder_Click(object sender, RoutedEventArgs e)
        {
            DirectoryInfo di = new DirectoryInfo(textBoxFolder.Text);
            di.ShowInWindowsExplorer();
        }

        private void buttonBrowseFile_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog();

            dialog.Title = "Select a file to show.";

            dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);

            DialogResult result = dialog.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                string fileName = dialog.FileName;

                textBoxFile.Text = fileName;
            }

        }

        private void buttonShowFile_Click(object sender, RoutedEventArgs e)
        {
            FileInfo fi = new FileInfo(textBoxFile.Text);
            fi.ShowInWindowsExplorer();
        }
    }
}
